Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Automatic Docking
Description: How to run automatic dockingKeywords: kobuki, docking, automatic docking
Tutorial Level: INTERMEDIATE
Next Tutorial: Gazebo Simulation
Contents
Overview
This tutorial will show you how to run automatic docking with kobuki, and will give you a brief description of algorithm. The code is located in kobuki_auto_docking package. It is implemented as a Nodelet, intended to run in the same manager as the kobuki node. To start/stop the algorithm, and get feedback, we use a Simple Action Server.
Running
Prerequisites
- Kobuki robot with a netbook
- Fully installed kobuki stack
- Docking Station
Setup
To run automatic docking properly, docking station should be placed in an open space of at least 2 meters wide by 5 meters long. There should be no obstacles between kobuki robot and docking station. And the dock station should be held by a wall or something heavy enough to prevent the robot to push it. A static red light on top of the docking station signals that it is powered on properly.
Loading
If everything is ready, you can easily launch the auto docking algorithm by using the commands below:
- If you already launched kobuki_node, load the auto-docking nodelet into the running kobuki core. For convenience, just type:
$ roslaunch kobuki_auto_docking minimal.launch --screen
- Or if you have not launched the kobuki core yet, type:
$ roslaunch kobuki_auto_docking compact.launch --screen
Be aware that this is just loading the algorithm; it is still not active. The algorithm is implemented as a typical action server. You need to call the server via an action client.
Activating
There is a convenient launcher which will run the action client in the kobuki_auto_docking package. To activate it type:
$ roslaunch kobuki_auto_docking activate.launch --screen
Kobuki robot will follow the docking station's infrared ray, and will dock automatically. If the robot manages to dock successfully, both the status LED of robot and docking station will start blinking with green light. When fully charged, you can see a static green light on both, with a happy be-beep sound from the robot:)
How it works
Docking Station
Kobuki's docking station has 3 IR(Infrared) emitters. The emitted IR lights cover three regions in front of the docking station: left, central and right, each divided in two sub-fields: near and far. Each beam encodes this information, so the robot knows at any moment in which region and sub-field he is. Also, as regions and fields are independently identified, they can be overlap on its borders.
IR Receivers
Kobuki has 3 IR receivers. When the robot is placed within the field of the docking station, and at least one IR receiver is facing toward it, the robot will catch the signal and stream it to the controller netbook. The information is available on /mobile_base/sensors/dock_ir topic, in the form of kobuki_msgs/DockInfraRed messages (link).
Brief Description
The basic idea is very simple. If the robot is placed on the central region of the docking station, it's easy to dock. Just by following the central region's signal, the robot can reach the docking station. However, if the robot is placed either on left or right region, things get more interesting.
If the robot is placed on left region, it will turn counter clock-wise until detecting the left region signal on his right sensor. At this point, the robot is facing the central region perpendicularly, so he just need to move forward to reach the central region. Now the robot should see the central region's signal, so reaching the docking station gets trivial. Starting on the right region is similar, but directions are inverted.
What's next
You have finished all intermediate tutorials. Continue on the next level.